#include <PauseState.h>

template<> PauseState* Ogre::Singleton<PauseState>::ms_Singleton = 0;

void PauseState::enter()
{
  _overlayMgr = Ogre::OverlayManager::getSingletonPtr();
  _overlayMgr->getByName("Pause")->show();

  _exitGame = false;
}

void PauseState::exit()
{
  _overlayMgr->getByName("Pause")->hide();
}

void PauseState::pause() {}

void PauseState::resume() {}

bool PauseState::frameStarted(const Ogre::FrameEvent& evt)
{
  return true;
}

bool PauseState::frameEnded(const Ogre::FrameEvent& evt)
{
  return not _exitGame;
}

void PauseState::keyPressed(const OIS::KeyEvent &e)
{
  // Tecla p --> Estado anterior.
  if (e.key == OIS::KC_P)
    popState();
}

void PauseState::keyReleased(const OIS::KeyEvent& e) {}

void PauseState::mouseMoved(const OIS::MouseEvent& e) {}

void PauseState::mousePressed(const OIS::MouseEvent& e, OIS::MouseButtonID id) {}

void PauseState::mouseReleased(const OIS::MouseEvent& e, OIS::MouseButtonID id) {}

PauseState* PauseState::getSingletonPtr()
{
  return ms_Singleton;
}

PauseState& PauseState::getSingleton()
{ 
  assert(ms_Singleton);
  return *ms_Singleton;
}
